// 定义单个筛选条件类型
import {FormItemRule} from "element-plus";
type operatorType = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte' | '$contains' | '$containsi' | '$in' | '$notIn'
export type FilterCondition = {
    // 字段名
    field?: string;
    fields?: string[], // 多值，此项有值时value为数组
    operators?:operatorType[]
    // 字段显示名
    title: string;
    // 操作符，如等于、包含、大于等
    operator: operatorType;
    // 筛选值
    value: any;
    // 输入组件，支持传入组件名或组件对象
    component: ComponentAttrs;
};

export type ComponentAttrs ={
    name: string;
    width?: string | number,
    height?: string | number,
    attrs?: any;
}

export type SortCondition = {
    // 排序字段
    field: string;
    // 排序顺序，asc 为升序，desc 为降序
    order: 'asc' | 'desc';
}
// 表单配置项
export type FormConfig = {
    title: string;
    field: string;
    defaultValue?: any;
    rules?: FormItemRule[];
    component: ComponentAttrs;
}
export type DetailConfig = {
    title: string;
    field: string;
    component?: ComponentAttrs;
}
export type SuccessCallback<T> = (data: T) => void;
